#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define A(i) a[i-1]
int partition(int *a,int s,int e)
{
	int i,j,temp;
	i=s-1;
	for(j=s;j<e;j++)
	{
		temp=A(j);
		if(A(j)<=A(e))
		{
			i++;
			A(j)=A(i);
			A(i)=temp;
		}
	}
	temp=A(e);
	A(e)=A(i+1);
	A(i+1)=temp;
	return i+1;
}

int quicksort(int *a,int s,int e)
{
	int q;
	if(s<e)
	{
		q=partition(a,s,e);
		quicksort(a,s,q-1);
		quicksort(a,q+1,e);
	}
}
int main()
{
	int i,j,k;
	int n;
	int *a;
	scanf("%d",&n);
	a=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	quicksort(a,1,n);
	for(i=0;i<n;i++) printf("%d ",a[i]);
	printf("\n");
	free(a);
	return 0;
}
